package com.bgs.controller;

import com.bgs.entity.Commodityorder;
import com.bgs.service.CommodityorderService;
import com.bgs.tool.R;
import com.bgs.vo.CommodityorderVo;
import com.bgs.vo.RecyclingorderVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/commodityorder")
public class CommodityorderController {
    @Autowired
    private CommodityorderService commodityorderService;

    @GetMapping("/getCommodityorder")
    @ApiOperation(value = "送货订单查")
    public R getCommodityorder(Integer riderId ,Integer coType){
        System.out.println(coType);
         List<CommodityorderVo> commodityorderVoList= commodityorderService.getCommodityorder(riderId,coType);
        return R.ok().data("commodityorderVoList",commodityorderVoList);
    }

    @GetMapping("/getCommodityorderImg")
    @ApiOperation(value = "送货订单商品图片查")
    public R getCommodityorderImg(Integer commodityId){
        List<CommodityorderVo> commodityorderImg= commodityorderService.getCommodityorderImg(commodityId);
        return R.ok().data("commodityorderImg",commodityorderImg);
    }

    @GetMapping("/getCommodityorderDetails")
    @ApiOperation(value = "送货订单商品详查")
    public R getCommodityorderDetails(Integer coId ,Integer riderId){
        List<CommodityorderVo> commodity= commodityorderService.getCommodityorderDetails(coId,riderId);
        return R.ok().data("commodity",commodity);
    }

    @GetMapping("/getCommodityorderType")
    @ApiOperation(value = "送货订单商品详查")
    public R getCommodityorderType(Integer coId ,Integer coType){
        System.out.println(coId);
        System.out.println(coType);
       Integer commodityType= commodityorderService.getCommodityorderType(coId,coType);
        return R.ok().data("commodityType",commodityType);
    }


    @GetMapping("/getCommodityorderCount")
    @ApiOperation(value = "送货订单商品详查")
    public R getCommodityorderCount(Integer riderId){
        CommodityorderVo count= commodityorderService.getCommodityorderCount(riderId);
        return R.ok().data("count",count);
    }
}
